user_list = [{"name":"张三","cardid":"000000000000","password":"000000","balance":"20000"},
             {"name": "李四", "cardid": "111111111111", "password": "000000", "balance": "30000"},
             {"name": "王五", "cardid": "222222222222", "password": "000000", "balance": "40000"}]
#用户登陆界面
print("="*10,"Bank of God","="*10)
print(" ")
print(" "*10,"ATM 自助取款机"," "*10)
print(" ")
print("="*10,"Made in ZQ","="*10)
#输入一个账户密码：
user_cardid = input("请输入您的账户：")
user_password = input("请输入您的账户密码：")
#定一个函数：用来检测密码正确性
def check(user_cardid , user_password):
    '''
    :param user_cardid: 从键盘接收用户的账户ID
    :param user_password: 从键盘接收用户的账户密码
    :return: 如果账户密码与内存内user_list的相同，则返回值为user_list的Key值，不相同为None
    '''
    for i in range(len(user_list)):
        if user_cardid == user_list[i]["cardid"] and user_password == user_list[i]["password"]:
            return i
#运行密码判断语句：
i = check(user_cardid,user_password)
#判断是否登录成功
if i != None:
    print("登陆成功")
    #死循环，用于重复输入操作值
    while True:
    #登陆成功进行操作界面：

        print("="*10,"欢迎光临:{}".format(user_list[i]["name"]),"="*10)
        print("{0:10} {1:8} {2:10}".format("1.查询余额","2.取款","3.存款"))
        print("{0:10} ".format("4.退出系统"))
        key = input("请输入您需要的服务：")
        if key == "1":
            print("账户信息：")
            print("账户用户名：{}".format(user_list[i]["name"]))
            print("账户卡号：{}".format(user_list[i]["cardid"]))
            print("账户余额(RMB)查询：{}".format(user_list[i]["balance"]))
            input("请按回车继续！！！")
        elif key == "2":
            user_list[i]["balance"] = int(user_list[i]["balance"])-int(input("请输入取款金额，按回车键取出："))
            print("目前账户余额为：{}".format(int(user_list[i]["balance"])))
            input("请按回车继续！！！")
        elif key == "3":
            user_list[i]["balance"] = int(user_list[i]["balance"]) + int(input("请将钞票叠整齐放入存钞口，并输入存入钞票数量："))
            print("目前账户余额为：{}".format(user_list[i]["balance"]))
            input("请按回车继续！！！")
        elif key == "4":
            print("请取走您的卡片，欢迎下次光临")
            break
        else:
            print("请输入有效数字进行操作")

else:
    print("账户密码错误!")

